import cv2 as cv
import numpy as np

img = cv.imread("G:\\py\\opencv\\test.png")
img2 = cv.imread("G:\\py\\opencv\\image\\171207032545.jpg")
#例子1
img[0,0] = [177,177,177]
#例子2
print(img.item(190,1,1))
img.itemset((190,1,1),255)
print(img.item(190,1,1))
#例子3
img[:,:,1] = 0
#创建窗口并显示图像
cv.namedWindow("Image")
cv.imshow("Image",img)
#例子4
roi = img2[0:100,0:100]
img[40:140,100:200] =roi
# cv.namedWindow("Image2")
cv.imshow("Image2",img)
print(img.shape)#NUmPy返回包含宽度，高度和通道数（如果是灰度没有通道值）
print(img.size)#图像大小
print(img.dtype)#类型uint8


cv.waitKey(0)
#释放窗口
cv.destroyAllWindows()


